<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        /* 1\ */
        .container{
            overflow: hidden;
        }
        .cube{
            height: 100px;
            width: 100px;
            background-color: pink;
            margin: 100px;
        }

        /* 2\ */
        .container1{
            overflow: hidden;
            border: 1px solid red ;
            /* display: flow-root; */
        }
        .cube1{
            height: 100px;
            width: 100px;
            background-color: pink;
            float: left;
            
        }

        /* 3/ */
        .float2{
            width: 100px;
            height: 100px;
            background-color: blue;
            float: left;
        }


        .normal{
            width: 200px;
            height: 200px;
            background-color: red;
            overflow: hidden;
            /* 触发正常元素的BFC属性 */
        }
    </style>
</head>
<body>
    <!-- 1、两个div上下边距margin合并 用overflow来解决 -->
    <div class="container">
        <div class="cube"></div>
        <div class="cube"></div>
    </div>
<!--     
    <div class="container">
        <div class="cube"></div>
    </div> -->
    

    <!-- 2、清除浮动 父容器overflow -->
     <!-- <div class="container1">
        <div class="cube1"></div>
     </div> -->


     <!-- 3、阻止元素被浮动元素覆盖 -->
      <!-- <div class="float2">
      </div>
      <div class="normal"></div> -->
</body>
</html>